﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChangePasswordForm.aspx.cs"
    Inherits="FX.CC.Andon.WebSite.CommForm.ChangePasswordForm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>修改密码</title>
    <script src="../lib/boot.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" method="post">
    <div style="padding-left: 11px; padding-bottom: 5px;">
        <table style="table-layout: fixed; padding-top: 10px;">
            <tr>
                <td>
                    登录账号：
                </td>
                <td style="width: 200px;">
                    <input name="LoginCode" style="width: 200px;" class="mini-textbox" required="true" />
                </td>
            </tr>
            <tr>
                <td>
                    职员姓名：
                </td>
                <td style="width: 200px;">
                    <input name="FullName" style="width: 200px;" class="mini-textbox" required="true" />
                </td>
            </tr>
            <tr>
                <td>
                    新密码：
                </td>
                <td style="width: 200px;">
                    <input name="NewPwd" style="width: 200px;" class="mini-password" required="true" />
                </td>
            </tr>
        </table>
    </div>
    <div style="text-align: center; padding: 10px;">
        <a class="mini-button" iconcls="icon-save" onclick="onOk" style="width: 60px; margin-right: 20px;">
            保存</a> <a class="mini-button" iconcls="icon-cancel" onclick="onCancel" style="width: 60px;">
                取消</a>
    </div>
    <script type="text/javascript">
        mini.parse();
        var form = new mini.Form("form1");
        var action;
        var UserID;
        function onOk(e) {
            SaveData();
        }
        function CloseWindow(action) {
            if (action == "close" && form.isChanged()) {
                if (confirm("数据被修改了，是否先保存？")) {
                    return false;
                }
            }
            if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
            else window.close();
        }

        function SetData(data) {
            if (data.action == "modify") {
                var LoginCode = mini.getbyName("LoginCode");
                LoginCode.setEnabled(false);
                var FullName = mini.getbyName("FullName");
                FullName.setEnabled(false);
                //跨页面传递的数据对象，克隆后才可以安全使用
                data = mini.clone(data);
                action = data.action;
                mini.getbyName("LoginCode").setValue(data.LoginCode);
                mini.getbyName("FullName").setValue(data.FullName);
                UserID = data.UserID;
            }
        }
        function SaveData() {
            var o = form.getData();
            o.UserID = UserID;
            var json = mini.encode([o]);
            form.validate();
            if (form.isValid() == false) return;
            if (action == "modify") {
                $.ajax({
                    url: "../Service/SystemManageHandler.ashx?action=ModifyPwd",
                    data: { data: json },
                    success: function (text) {
                        if (text) {
                            alert("密码修改成功");
                        }
                        CloseWindow("save");
                    },
                    error: function (jqXHR, textStatus, errorThrown) {
                        alert(jqXHR.responseText);
                    }
                });
            }
        }
        function GetData() {
            var o = form.getData();
            return o;
        }
        function onCancel(e) {
            CloseWindow("cancel");
        }
    </script>
    </form>
</body>
</html>
